package ru.kvolkov.myreader.ui;

import android.app.AlertDialog;
import android.content.Context;

import ru.kvolkov.myreader.R;
import ru.kvolkov.myreader.utils.AssetsHelper;

/** 
 * Represents an About dialog. 
 */
public class AboutDialog {
	/** 
	 * Initializes a new instance of AboutDialog class. 
	 */
	private AboutDialog() {
	}

	/** 
	 * Show a dialog with information about MyReader application. 
	 */
	public static void show(Context context) {
		String aboutText = getAboutText(context);
		new AlertDialog.Builder(context)
			.setTitle(R.string.app_name)
			.setMessage(aboutText)
			.setPositiveButton(R.string.dialog_button_close, null)
			.create()
			.show();
	}

	private static String getAboutText(Context context) {
		AssetsHelper assets = new AssetsHelper(context);
		return assets.readAllText("text/about.txt");
	}
}
